package com.tencent.controller;


import com.tencent.fegin.UserFegin;
import com.tencent.service.BigFileService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
     * 李建 2020年5月19日17:05:57
     * 文件Controller
     * 处理文件的上传与下载
     */
@RestController
@RequestMapping("/bigFile")
@CrossOrigin
public class BigFileController {

       @Autowired
        BigFileService bigFileService;
       @Autowired
    UserFegin userFegin;

//        /**
//         * 处理文件上传POST请求
//         * 将上传的文件存放到服务器内
//         * @param chunk 文件块
//         * @param response 响应
//         * @return 上传响应状态
//         */
//  @RequestMapping("/fileUpload")
// public String uploadPost(@ModelAttribute Chunk chunk, HttpServletResponse response){
//
//         return bigFileService.fileUploadPost(chunk,response);
//
//  }




//    SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy/MM/dd");
//    @RequestMapping("/fileUpload1")
//    public Result uploadPost1(@ModelAttribute Chunk chunk, HttpServletResponse response){
//        MultipartFile multipartFile=chunk.getFiles();
//        Map<String,Object> map=new HashMap<>();
//        String originalFilename = chunk.getFilename();
//        if(!originalFilename.endsWith(".mp4")){
//            return new Result(StatusCode.ERROR,"文件类型不对",false);
//        }
//        String format = simpleDateFormat.format(new Date());
//        System.out.println("format是:" + format);
//        String newName = UUID.randomUUID().toString() + ".mp4";
//        String objectName=format+newName;
//        Result result = OSSUtils.createOSSClient(objectName, multipartFile);
//        System.err.println(result.getData().toString());
//        return result;
//    }

    /**
     * 测试zipink
     * @return
     */
    @RequestMapping("/testZipink")
    public String testZip(){
        return userFegin.getZipkin();
}
















    }













